{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from selenium import webdriver\n",
    "from selenium.webdriver import ActionChains\n",
    "import time, random\n",
    "import requests\n",
    "import re\n",
    "import json\n",
    "import pickle\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# def get_proxy_ip():\n",
    "#     try:\n",
    "#         zhima_ip = r'http://webapi.http.zhimacangku.com/getip?num=1&type=1&pro=&city=0&yys=0&port=11&pack=34560&ts=0&ys=0&cs=0&lb=1&sb=0&pb=4&mr=1&regions='\n",
    "#         proxy = requests.get(zhima_ip).text[:-2]\n",
    "#         time.sleep(1.5)\n",
    "#         prox = {\n",
    "#             'https': 'https://{}'.format(proxy),\n",
    "#             'http': 'http://{}'.format(proxy)}\n",
    "#         res = requests.get('http://2018.ip138.com/ic.asp', proxies=prox, timeout=10)\n",
    "#         if res.status_code == 200:\n",
    "#             return proxy.split(':')\n",
    "#         else:\n",
    "#             return get_proxy_ip()\n",
    "#     except:\n",
    "#         return get_proxy_ip()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# proxy_url, port = get_proxy_ip()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.3538.102 Safari/537.36'\n",
    "user_agent = \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\"\n",
    "# user_agent = 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; InfoPath.3; rv:11.0) like Gecko'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "fp = webdriver.FirefoxProfile()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "fp.set_preference(\"general.useragent.override\", user_agent)\n",
    "# fp.set_preference('network.proxy.type', 1)\n",
    "# fp.set_preference('network.proxy.http', proxy_url)\n",
    "# fp.set_preference('network.proxy.http_port', int(port))\n",
    "# fp.set_preference('network.proxy.ssl', proxy_url)\n",
    "# fp.set_preference('network.proxy.ssl_port', int(port))\n",
    "fp.update_preferences()\n",
    "driver = webdriver.Firefox(firefox_profile=fp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "# driver.get('http://www.useragentstring.com/')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def set_navigator():\n",
    "    script_webdriver = '''Object.defineProperties(navigator,{\n",
    "    webdriver:{\n",
    "    get:() => false\n",
    "    }\n",
    "    })'''\n",
    "    script_language = ''' Object.defineProperty(navigator, 'languages', {\n",
    "        get: () => [ \"zh-CN\", \"zh\", \"zh-TW\", \"zh-HK\", \"en-US\", \"en\" ],\n",
    "      });'''\n",
    "    driver.execute_script(script_webdriver)\n",
    "    driver.execute_script(script_language)\n",
    "    print('navigator set successfully')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "navigator set successfully\n"
     ]
    }
   ],
   "source": [
    "set_navigator()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.get('https://only.m.tmall.com/shop/shop_auction_search.htm?sort=default')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "navigator set successfully\n"
     ]
    }
   ],
   "source": [
    "driver.refresh()\n",
    "set_navigator()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "# driver.firefox_profile.update_preferences()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "# driver.firefox_profile.default_preferences['network.proxy.type'] = 1\n",
    "# driver.firefox_profile.default_preferences['network.proxy.http'] = proxy_url\n",
    "# driver.firefox_profile.default_preferences['network.proxy.http_port'] = int(port)\n",
    "# driver.firefox_profile.default_preferences['network.proxy.ssl'] = proxy_url\n",
    "# driver.firefox_profile.default_preferences['network.proxy.ssl_port'] = port\n",
    "# driver.firefox_profile.update_preferences()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "iframe = driver.find_element_by_css_selector('#sufei-dialog-content')\n",
    "driver.switch_to.frame(iframe)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.find_element_by_css_selector('#TPL_username_1').send_keys('17621780176')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.find_element_by_css_selector('#TPL_password_1').send_keys('www.,194928.,com')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.find_element_by_css_selector('#J_SubmitStatic').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "# driver.find_element_by_css_selector('#TPL_password_1').send_keys('www.,194928.,com')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "ename": "NoSuchElementException",
     "evalue": "Message: Unable to locate element: //*[@id='nc_1_n1t']/span\n",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNoSuchElementException\u001b[0m                    Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-14-e2700121617c>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[0maction\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mActionChains\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdriver\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0msource\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdriver\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind_element_by_xpath\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"//*[@id='nc_1_n1t']/span\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;31m#需要滑动的元素\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      3\u001b[0m \u001b[0maction\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclick_and_hold\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msource\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mperform\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      4\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0.5\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      5\u001b[0m \u001b[0maction\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmove_by_offset\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m206\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;31m#需要滑动的坐标\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001b[0m in \u001b[0;36mfind_element_by_xpath\u001b[1;34m(self, xpath)\u001b[0m\n\u001b[0;32m    392\u001b[0m             \u001b[0melement\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdriver\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind_element_by_xpath\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'//div/td[1]'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    393\u001b[0m         \"\"\"\n\u001b[1;32m--> 394\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind_element\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mby\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mBy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mXPATH\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mxpath\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    395\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    396\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mfind_elements_by_xpath\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mxpath\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001b[0m in \u001b[0;36mfind_element\u001b[1;34m(self, by, value)\u001b[0m\n\u001b[0;32m    976\u001b[0m         return self.execute(Command.FIND_ELEMENT, {\n\u001b[0;32m    977\u001b[0m             \u001b[1;34m'using'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mby\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 978\u001b[1;33m             'value': value})['value']\n\u001b[0m\u001b[0;32m    979\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    980\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mfind_elements\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mby\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mBy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mID\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001b[0m in \u001b[0;36mexecute\u001b[1;34m(self, driver_command, params)\u001b[0m\n\u001b[0;32m    319\u001b[0m         \u001b[0mresponse\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcommand_executor\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdriver_command\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    320\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mresponse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 321\u001b[1;33m             \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0merror_handler\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcheck_response\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    322\u001b[0m             response['value'] = self._unwrap_value(\n\u001b[0;32m    323\u001b[0m                 response.get('value', None))\n",
      "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\errorhandler.py\u001b[0m in \u001b[0;36mcheck_response\u001b[1;34m(self, response)\u001b[0m\n\u001b[0;32m    240\u001b[0m                 \u001b[0malert_text\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'alert'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'text'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    241\u001b[0m             \u001b[1;32mraise\u001b[0m \u001b[0mexception_class\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mscreen\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstacktrace\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0malert_text\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 242\u001b[1;33m         \u001b[1;32mraise\u001b[0m \u001b[0mexception_class\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mscreen\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstacktrace\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    243\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    244\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0m_value_or_default\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdefault\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNoSuchElementException\u001b[0m: Message: Unable to locate element: //*[@id='nc_1_n1t']/span\n"
     ]
    }
   ],
   "source": [
    "action = ActionChains(driver)\n",
    "source=driver.find_element_by_xpath(\"//*[@id='nc_1_n1t']/span\")#需要滑动的元素\n",
    "action.click_and_hold(source).perform()\n",
    "time.sleep(0.5)\n",
    "action.move_by_offset(206,0)#需要滑动的坐标\n",
    "time.sleep(1.2)\n",
    "action.release().perform() #释放鼠标"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [],
   "source": [
    "# script_refresh = 'javascript:noCaptcha.reset(1)'\n",
    "# driver.execute_script(script_refresh)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "ename": "NoSuchElementException",
     "evalue": "Message: Unable to locate element: #J_SubmitStatic\n",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNoSuchElementException\u001b[0m                    Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-15-c20e8cbb0568>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdriver\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind_element_by_css_selector\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'#J_SubmitStatic'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclick\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001b[0m in \u001b[0;36mfind_element_by_css_selector\u001b[1;34m(self, css_selector)\u001b[0m\n\u001b[0;32m    596\u001b[0m             \u001b[0melement\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdriver\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind_element_by_css_selector\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'#foo'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    597\u001b[0m         \"\"\"\n\u001b[1;32m--> 598\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind_element\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mby\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mBy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mCSS_SELECTOR\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mcss_selector\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    599\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    600\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mfind_elements_by_css_selector\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcss_selector\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001b[0m in \u001b[0;36mfind_element\u001b[1;34m(self, by, value)\u001b[0m\n\u001b[0;32m    976\u001b[0m         return self.execute(Command.FIND_ELEMENT, {\n\u001b[0;32m    977\u001b[0m             \u001b[1;34m'using'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mby\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 978\u001b[1;33m             'value': value})['value']\n\u001b[0m\u001b[0;32m    979\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    980\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mfind_elements\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mby\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mBy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mID\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001b[0m in \u001b[0;36mexecute\u001b[1;34m(self, driver_command, params)\u001b[0m\n\u001b[0;32m    319\u001b[0m         \u001b[0mresponse\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcommand_executor\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdriver_command\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    320\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mresponse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 321\u001b[1;33m             \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0merror_handler\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcheck_response\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    322\u001b[0m             response['value'] = self._unwrap_value(\n\u001b[0;32m    323\u001b[0m                 response.get('value', None))\n",
      "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\errorhandler.py\u001b[0m in \u001b[0;36mcheck_response\u001b[1;34m(self, response)\u001b[0m\n\u001b[0;32m    240\u001b[0m                 \u001b[0malert_text\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'alert'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'text'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    241\u001b[0m             \u001b[1;32mraise\u001b[0m \u001b[0mexception_class\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mscreen\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstacktrace\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0malert_text\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 242\u001b[1;33m         \u001b[1;32mraise\u001b[0m \u001b[0mexception_class\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mscreen\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstacktrace\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    243\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    244\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0m_value_or_default\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdefault\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNoSuchElementException\u001b[0m: Message: Unable to locate element: #J_SubmitStatic\n"
     ]
    }
   ],
   "source": [
    "driver.find_element_by_css_selector('#J_SubmitStatic').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 缺少处理如何滑动解锁的步骤"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.get('https://semir.m.tmall.com/shop/shop_auction_search.htm')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "navigator set successfully\n"
     ]
    }
   ],
   "source": [
    "driver.refresh()\n",
    "set_navigator()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "no need switch to iframe\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'滑动解锁完成'"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# iframe2 = driver.find_element_by_css_selector('#sufei-dialog-content')\n",
    "def outside_code():\n",
    "    try:\n",
    "        iframe = driver.find_element_by_css_selector('#sufei-dialog-content')\n",
    "        driver.switch_to.frame(iframe)\n",
    "    except:\n",
    "        print('no need switch to iframe')\n",
    "    try:\n",
    "        action = ActionChains(driver)\n",
    "        source=driver.find_element_by_xpath(\"//*[@id='nc_1_n1t']/span\")#需要滑动的元素\n",
    "        action.click_and_hold(source).perform()\n",
    "        time.sleep(0.5)\n",
    "        action.move_by_offset(258,0)#需要滑动的坐标\n",
    "        time.sleep(1.2)\n",
    "        action.release().perform() #释放鼠标\n",
    "    except:\n",
    "        pass\n",
    "    return '滑动解锁完成'\n",
    "outside_code()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [],
   "source": [
    "# iframe2 = driver.find_element_by_css_selector('#sufei-dialog-content')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.get('https://only.m.tmall.com/shop/shop_auction_search.htm?suid=356060330&sort=default')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [],
   "source": [
    "# driver.execute_script(\"window.scrollBy(0, 700)\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "def scroll_phone():\n",
    "    print('---正在滚动，请等待')\n",
    "    for i in range(30):\n",
    "        time.sleep(1)\n",
    "        driver.execute_script(\"window.scrollTo(0, document.body.scrollHeight)\")\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [],
   "source": [
    "# for i in range(10):\n",
    "#     a = i * 10000\n",
    "#     b = (i+1) * 10000\n",
    "#     script = \"window.scrollTo({},{})\".format(a, b)\n",
    "#     driver.execute_script(script)\n",
    "#     time.sleep(random.randint(1, 3) + 1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 获取总页数的函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "def func_totalpage():\n",
    "    firt_page_url = 'https://{}.m.tmall.com/shop/shop_auction_search.do?ajson=1&_tm_source=tmallsearch&sort=s&p=1&page_size=12&from=h5&shop_id=57303596&callback=jsonp_{}'.format(shop_name, num)\n",
    "    driver.get(firt_page_url)\n",
    "    html = driver.page_source\n",
    "    try:\n",
    "        infos = re.findall(r'\\(({.*})\\)', html)[0]\n",
    "        infos = json.loads(infos)\n",
    "        totalpage = int(infos.get('total_page'))\n",
    "        return int(totalpage) #*1.04\n",
    "    except:\n",
    "        raise IndexError"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_totalpage(shop_name):\n",
    "    try:\n",
    "        totalpage = func_totalpage()\n",
    "    except IndexError:\n",
    "        driver.get('https://{}.m.tmall.com/shop/shop_auction_search.htm?sort=default'.format(shop_name))\n",
    "        time.sleep(random.random()*5 + 1)\n",
    "        hand = input('\\n总页数，请手动滑动解锁\\n')\n",
    "        if hand == 'b':\n",
    "            raise ValueError\n",
    "        else:\n",
    "            pass\n",
    "#         print(outside_code())\n",
    "        totalpage = func_totalpage()\n",
    "    return totalpage"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "def try_totalpage():\n",
    "    try:\n",
    "        totalpage = get_totalpage(shop_name)\n",
    "        return totalpage\n",
    "    except IndexError:\n",
    "        return try_totalpage()\n",
    "    except ValueError:\n",
    "        return 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 获取所有品牌的总宝贝页数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_one_url():\n",
    "    \"\"\"从文件获取需要爬取的url链接\"\"\"\n",
    "    url_file = r\"D:\\Python\\TmallCrawler\\file\\Tmall_shop_home_clothe\"\n",
    "    with open(url_file, 'r', encoding='utf-8') as f:\n",
    "        csv_reader = f.read().split('\\n')\n",
    "        for row in csv_reader:\n",
    "            yield row.split('\\t')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "GU is beginning\n",
      "GU have 44 page items\n",
      "家乐芬 is beginning\n",
      "家乐芬 have 43 page items\n",
      "OYSHO is beginning\n",
      "OYSHO have 64 page items\n",
      "安之伴 is beginning\n",
      "安之伴 have 16 page items\n",
      "芬腾 is beginning\n",
      "芬腾 have 30 page items\n",
      "果壳 is beginning\n",
      "果壳 have 30 page items\n",
      "贝妍 is beginning\n",
      "贝妍 have 27 page items\n",
      "优衣库 is beginning\n",
      "优衣库 have 92 page items\n"
     ]
    }
   ],
   "source": [
    "brand_json = []\n",
    "for brand_name, shop_url in get_one_url():\n",
    "    shop_name = shop_url[8:-12]\n",
    "    print('{} is beginning'.format(brand_name))\n",
    "    num = random.randint(10127482, 75727482)\n",
    "    totalpage = try_totalpage()\n",
    "    print('{} have {} page items'.format(brand_name, totalpage))\n",
    "    brand_json.append((brand_name, shop_name, shop_url, totalpage))\n",
    "with open('brand_json', 'wb+') as f:\n",
    "    f.write(pickle.dumps(brand_json))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "navigator set successfully\n"
     ]
    }
   ],
   "source": [
    "set_navigator()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 获取每一页数据，对于获取失败的，保存，最后重新下载"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 重新读取所有的品牌和总页数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('brand_json', 'rb') as f:\n",
    "    brand_json = pickle.loads(f.read())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 获取每页的宝贝列表函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_one_page(shop_name, i, num):\n",
    "    print('---第',i,'页正在加载')\n",
    "    url = 'https://{}.m.tmall.com/shop/shop_auction_search.do?ajson=1&_tm_source=tmallsearch&sort=s&p={}&page_size=12&from=h5&callback=jsonp_{}'.format(shop_name, i, num)\n",
    "    #https://handuyishe.m.tmall.com/shop/shop_auction_search.do?sort=s&p=1&page_size=12&from=h5&ajson=1&_tm_source=tmallsearch&callback=jsonp_42750715\n",
    "    driver.get(url)\n",
    "    time.sleep(random.random() + 1)\n",
    "    html = driver.page_source\n",
    "    if re.findall(r'\\(({.*})\\)', html):\n",
    "        infos = re.findall(r'\\(({.*})\\)', html)[0]\n",
    "        infos = json.loads(infos)\n",
    "        products = infos.get('items')\n",
    "        if products:\n",
    "            for one_item in products:\n",
    "                one_item['store_name'] = shop_name\n",
    "                one_item['page'] = str(i)\n",
    "        else:\n",
    "            raise IndexError\n",
    "    else:\n",
    "        raise IndexError\n",
    "    return products"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 对每个店铺的数据进行保存"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "# store_name = input('请输入店铺名： ')\n",
    "def get_one_store(brand_name, shop_url, begin_page):\n",
    "    shop_name = shop_url[8:-12]\n",
    "    all_page = []\n",
    "    for i in range(begin_page, totalpage+1):\n",
    "        print('当前页面是: 第', i, '页')\n",
    "        try:\n",
    "            products = get_one_page(shop_name, i, num) #获取每页的数据\n",
    "            df = pd.DataFrame(products)\n",
    "            col = df.columns\n",
    "            df.to_csv('D:\\\\Jupyter\\\\all_brand\\\\0110\\\\{}_0110.csv'.format(brand_name), mode='a+', header=False, columns=col, encoding='utf-8')\n",
    "            print('---第 {} 页加载完成\\n'.format(i))\n",
    "        except (TypeError, IndexError):\n",
    "            driver.get('{}/shop/shop_auction_search.htm?sort=default'.format(shop_url))\n",
    "            scroll_phone()\n",
    "            hand = input('\\n单页，请手动滑动解锁\\n')\n",
    "            print(hand)\n",
    "            one_brank = '{},{}\\n'.format(brand_name, i)\n",
    "            with open('break_file', 'a+') as f:\n",
    "                f.write(one_brank)\n",
    "            if hand == '1':\n",
    "                raise IndexError\n",
    "            else:\n",
    "                pass\n",
    "    return '------{} finished!'.format(brand_name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "def try_one_store():\n",
    "    try:\n",
    "        print(get_one_store(brand_name, shop_url, begin_page))\n",
    "    except IndexError:\n",
    "         if 'b' == input('need break: '):\n",
    "            return None\n",
    "         else:\n",
    "            return try_one_store()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "----GU----: 1\n",
      "GU is beginning\n",
      "GU have 44 page items\n",
      "起始页数： 44\n",
      "need totalpage: 55\n",
      "当前页面是: 第 44 页\n",
      "---第 44 页正在加载\n",
      "---第 44 页加载完成\n",
      "\n",
      "------GU finished!\n",
      "None\n",
      "----家乐芬----: \n",
      "家乐芬 is beginning\n",
      "家乐芬 have 43 page items\n",
      "起始页数： 1\n",
      "need totalpage: 43\n",
      "当前页面是: 第 1 页\n",
      "---第 1 页正在加载\n",
      "---第 1 页加载完成\n",
      "\n",
      "当前页面是: 第 2 页\n",
      "---第 2 页正在加载\n",
      "---第 2 页加载完成\n",
      "\n",
      "当前页面是: 第 3 页\n",
      "---第 3 页正在加载\n",
      "---第 3 页加载完成\n",
      "\n",
      "当前页面是: 第 4 页\n",
      "---第 4 页正在加载\n",
      "---第 4 页加载完成\n",
      "\n",
      "当前页面是: 第 5 页\n",
      "---第 5 页正在加载\n",
      "---第 5 页加载完成\n",
      "\n",
      "当前页面是: 第 6 页\n",
      "---第 6 页正在加载\n",
      "---第 6 页加载完成\n",
      "\n",
      "当前页面是: 第 7 页\n",
      "---第 7 页正在加载\n",
      "---第 7 页加载完成\n",
      "\n",
      "当前页面是: 第 8 页\n",
      "---第 8 页正在加载\n",
      "---第 8 页加载完成\n",
      "\n",
      "当前页面是: 第 9 页\n",
      "---第 9 页正在加载\n",
      "---第 9 页加载完成\n",
      "\n",
      "当前页面是: 第 10 页\n",
      "---第 10 页正在加载\n",
      "---第 10 页加载完成\n",
      "\n",
      "当前页面是: 第 11 页\n",
      "---第 11 页正在加载\n",
      "---第 11 页加载完成\n",
      "\n",
      "当前页面是: 第 12 页\n",
      "---第 12 页正在加载\n",
      "---第 12 页加载完成\n",
      "\n",
      "当前页面是: 第 13 页\n",
      "---第 13 页正在加载\n",
      "---第 13 页加载完成\n",
      "\n",
      "当前页面是: 第 14 页\n",
      "---第 14 页正在加载\n",
      "---第 14 页加载完成\n",
      "\n",
      "当前页面是: 第 15 页\n",
      "---第 15 页正在加载\n",
      "---第 15 页加载完成\n",
      "\n",
      "当前页面是: 第 16 页\n",
      "---第 16 页正在加载\n",
      "---第 16 页加载完成\n",
      "\n",
      "当前页面是: 第 17 页\n",
      "---第 17 页正在加载\n",
      "---第 17 页加载完成\n",
      "\n",
      "当前页面是: 第 18 页\n",
      "---第 18 页正在加载\n",
      "---第 18 页加载完成\n",
      "\n",
      "当前页面是: 第 19 页\n",
      "---第 19 页正在加载\n",
      "---第 19 页加载完成\n",
      "\n",
      "当前页面是: 第 20 页\n",
      "---第 20 页正在加载\n",
      "---第 20 页加载完成\n",
      "\n",
      "当前页面是: 第 21 页\n",
      "---第 21 页正在加载\n",
      "---第 21 页加载完成\n",
      "\n",
      "当前页面是: 第 22 页\n",
      "---第 22 页正在加载\n",
      "---第 22 页加载完成\n",
      "\n",
      "当前页面是: 第 23 页\n",
      "---第 23 页正在加载\n",
      "---第 23 页加载完成\n",
      "\n",
      "当前页面是: 第 24 页\n",
      "---第 24 页正在加载\n",
      "---第 24 页加载完成\n",
      "\n",
      "当前页面是: 第 25 页\n",
      "---第 25 页正在加载\n",
      "---第 25 页加载完成\n",
      "\n",
      "当前页面是: 第 26 页\n",
      "---第 26 页正在加载\n",
      "---正在滚动，请等待\n",
      "\n",
      "单页，请手动滑动解锁\n",
      "\n",
      "\n",
      "当前页面是: 第 27 页\n",
      "---第 27 页正在加载\n",
      "---第 27 页加载完成\n",
      "\n",
      "当前页面是: 第 28 页\n",
      "---第 28 页正在加载\n",
      "---第 28 页加载完成\n",
      "\n",
      "当前页面是: 第 29 页\n",
      "---第 29 页正在加载\n",
      "---第 29 页加载完成\n",
      "\n",
      "当前页面是: 第 30 页\n",
      "---第 30 页正在加载\n",
      "---第 30 页加载完成\n",
      "\n",
      "当前页面是: 第 31 页\n",
      "---第 31 页正在加载\n",
      "---第 31 页加载完成\n",
      "\n",
      "当前页面是: 第 32 页\n",
      "---第 32 页正在加载\n",
      "---第 32 页加载完成\n",
      "\n",
      "当前页面是: 第 33 页\n",
      "---第 33 页正在加载\n",
      "---第 33 页加载完成\n",
      "\n",
      "当前页面是: 第 34 页\n",
      "---第 34 页正在加载\n",
      "---第 34 页加载完成\n",
      "\n",
      "当前页面是: 第 35 页\n",
      "---第 35 页正在加载\n",
      "---第 35 页加载完成\n",
      "\n",
      "当前页面是: 第 36 页\n",
      "---第 36 页正在加载\n",
      "---第 36 页加载完成\n",
      "\n",
      "当前页面是: 第 37 页\n",
      "---第 37 页正在加载\n",
      "---第 37 页加载完成\n",
      "\n",
      "当前页面是: 第 38 页\n",
      "---第 38 页正在加载\n",
      "---第 38 页加载完成\n",
      "\n",
      "当前页面是: 第 39 页\n",
      "---第 39 页正在加载\n",
      "---第 39 页加载完成\n",
      "\n",
      "当前页面是: 第 40 页\n",
      "---第 40 页正在加载\n",
      "---第 40 页加载完成\n",
      "\n",
      "当前页面是: 第 41 页\n",
      "---第 41 页正在加载\n",
      "---第 41 页加载完成\n",
      "\n",
      "当前页面是: 第 42 页\n",
      "---第 42 页正在加载\n",
      "---第 42 页加载完成\n",
      "\n",
      "当前页面是: 第 43 页\n",
      "---第 43 页正在加载\n",
      "---第 43 页加载完成\n",
      "\n",
      "------家乐芬 finished!\n",
      "None\n"
     ]
    }
   ],
   "source": [
    "for one_brand in brand_json[:2]:\n",
    "    brand_name, shop_name, shop_url, totalpage = one_brand\n",
    "    a = input('----{}----: '.format(brand_name))\n",
    "    if a == 'y':\n",
    "        print(brand_name, 'is finished')\n",
    "    else:\n",
    "        print('{} is beginning'.format(brand_name))\n",
    "        num = random.randint(10127482, 85727482)\n",
    "        print('{} have {} page items'.format(brand_name, totalpage))\n",
    "        begin_page = int(input(\"起始页数： \"))\n",
    "        a = input('need totalpage: ')\n",
    "        if a == 'need':\n",
    "            totalpage = int(input('---: '))\n",
    "            print(try_one_store())\n",
    "        else:\n",
    "            print(try_one_store())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
